package com.nbsaas.boot.cms.rest.convert;

import com.nbsaas.boot.cms.data.entity.Article;
import com.nbsaas.boot.cms.api.domain.simple.ArticleSimple;

import com.nbsaas.boot.rest.api.Converter;
import java.util.HashMap;
import java.util.Map;
/**
* 列表对象转换器
*/

public class ArticleSimpleConvert implements Converter<ArticleSimple, Article> {




@Override
public ArticleSimple convert(Article source) {
    ArticleSimple result = new ArticleSimple();

                result.setId(source.getId());
                if(source.getState()!=null){
                Map<Integer,String> StateMap=new HashMap<>();
                    StateMap.put(1,"正常");
                    StateMap.put(2,"删除");
                String label=  StateMap.get(source.getState());
                result.setStateName(label);
                }
                result.setState(source.getState());
                result.setTitle(source.getTitle());


    return result;
}

}